package controllers

import (
	"gin-worked/app/common/service"
	"gin-worked/app/common/validate"
	"gin-worked/work"
	"github.com/gin-gonic/gin"
)

type UserController struct {
}

func (u UserController) Login(c *gin.Context) {
	var login validate.Login
	if err := c.ShouldBind(&login); err != nil {
		work.ReturnResult(c, 0, err.Error(), "")
		return
	}

	param := c.MustGet("params").(map[string]string)
	res := service.Login(param["Username"], param["Password"])
	work.ReturnResult(c, res.Code, res.Msg, res.Data)
}
